<template>
	<view>
		<swiper class="swiper" :current="TabCur" style="height:300rpx">
			<swiper-item><image style="width:100%;height:300rpx" src="https://main.hsh.com.cn/report/images/store0.png"></image></swiper-item>
			<swiper-item><image style="width:100%;height:300rpx" src="https://main.hsh.com.cn/report/images/store2.png"></image></swiper-item>
			<swiper-item><image style="width:100%;height:300rpx" src="https://main.hsh.com.cn/report/images/store3.png"></image></swiper-item>
			<swiper-item><image style="width:100%;height:300rpx" src="https://main.hsh.com.cn/report/images/store4.png"></image></swiper-item>
		</swiper>

		<view class="tishiBox">
			<uni-row>
				<uni-col :span="6"><text>温馨提示：</text></uni-col>
				<uni-col :span="18"><text>为更好为您服务，请您仔细填写，您的信息我们将会妥善保管。</text></uni-col>
			</uni-row>
		</view>

		<wuc-tab :tab-list="tabList" tab-class="text-color" :tabCur.sync="TabCur" textFlex @change="tabChange"></wuc-tab>

		<uni-card style="margin:0!important;padding:0!important;">
			<uni-forms ref="form" :rules="rules" border :modelValue="formData">
				<view v-show="TabCur == 0">
					<uni-forms-item required :label-align="labelAlign" name="username" label="姓名:" :label-width="100">
						<uni-row>
							<uni-col><uni-easyinput :inputBorder="false" :clearable="true" type="text" v-model="formData.username" placeholder="请输入姓名" /></uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="sex" label="性别:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'sex');
								}
							"
							:value="formData.sex"
							:range="sex.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.sex || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="age" label="年龄:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'age');
								}
							"
							:value="formData.age"
							:range="age.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.age || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="phone" label="联系电话:" :label-width="100">
						<uni-row>
							<uni-col><uni-easyinput :inputBorder="false" :clearable="true" trim type="number" v-model="formData.phone" placeholder="请输入联系电话" /></uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="address" label="现居地址:" :label-width="100">
						<uni-row>
							<uni-col><uni-easyinput :inputBorder="false" :clearable="true" type="text" v-model="formData.address" placeholder="请输入现居地址" /></uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="education" label="学历:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'education');
								}
							"
							:value="formData.education"
							:range="education.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.education || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<view class="remind"> <text>*</text>风险与机遇并存，谨慎选择才能稳健前行</view>
					<button class="button" @click="tabChange([0, 1])">下一步</button>
				</view>
				<view v-show="TabCur == 1">
					<uni-forms-item required :label-align="labelAlign" name="region" label="意向开店城市:" :label-width="100">
						<picker
							mode="region"
							@change="
								e => {
									changePicker(e, 'region');
								}
							"
							:value="formData.region"
						>
							<view class="uni-input">{{ formData.region.join('-') || '(省、市、区/县)' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="addressDetail" label="详细地址:" :label-width="100">
						<uni-row>
							<uni-col><uni-easyinput :inputBorder="false" :clearable="true" type="text" v-model="formData.addressDetail" placeholder="请输入详细地址" /></uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="socialResources" label="社会关系资源:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'socialResources');
								}
							"
							:value="formData.socialResources"
							:range="socialResources.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.socialResources || '(商会、企业协会等)' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="publicResources" label="公共关系资源:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'publicResources');
								}
							"
							:value="formData.publicResources"
							:range="publicResources.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.publicResources || '(企事业单位、政府机构)' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="complexResources" label="店铺资源:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'complexResources');
								}
							"
							:value="formData.complexResources"
							:range="complexResources.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.complexResources || '(商超、机场、高铁等)' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item :label-align="labelAlign" label="店铺地址:" :label-width="100" name="storePlace">
						<uni-row>
							<uni-col>
								<uni-easyinput :inputBorder="false" :clearable="true" type="text" v-model="formData.storePlace" placeholder="(具体到城市/县城/乡镇)" />
							</uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item :label-align="labelAlign" name="wxPic" label="微信二维码:" :label-width="100">
						<uni-row>
							<uni-col :span="24">
								<view class="bg-img" v-if="formData.wxPic">
									<image :src="formData.wxPic" mode="aspectFill" @click="ViewImage"></image>
									<view class="cu-tag bg-red" @click="del">X</view>
								</view>
								<view class="solids" v-else @click="choose" data-type="1"><text class="cuIcon-cameraadd"></text></view>
							</uni-col>
						</uni-row>
						<uni-row>
							<uni-col :span="24">
								<text style="color: rgba(0,0,0,0.4);">
									为便捷沟通，工作人员能及时分享咨询给您，请上传二位码附件(方式：打开个人微信，查看个人信息，打开二位码，截图上传
								</text>
							</uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="experience" label="工作经验:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'experience');
								}
							"
							:value="formData.experience"
							:range="experience.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.experience || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<view class="remind"> <text>*</text>风险与机遇并存，谨慎选择才能稳健前行</view>
					<button class="button" @click="tabChange([1, 2])">下一步</button>
				</view>
				<view v-show="TabCur == 2">
					<uni-forms-item required :label-align="labelAlign" name="way" label="了解途径:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'way');
								}
							"
							:value="formData.way"
							:range="way.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.way || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="whetherEat" label="是否尝过产品:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'whetherEat');
								}
							"
							:value="formData.whetherEat"
							:range="whetherEat.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.whetherEat || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item :label-align="labelAlign" label="常买产品名称:" :label-width="100" name="favoriteFood">
						<uni-row>
							<uni-col><uni-easyinput :inputBorder="false" :clearable="true" type="text" v-model="formData.favoriteFood" placeholder="请输入产品名称" /></uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="brandCognition" label="品牌认知:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'brandCognition');
								}
							"
							:value="formData.brandCognition"
							:range="brandCognition.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.brandCognition || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item :label-align="labelAlign" name="storeMsg" label="您最了解的一家煌上煌门店概况:" :label-width="210" :label-position="'top'">
						<uni-row>
							<uni-col :offset="2" :span="21">
								<uni-easyinput
									:inputBorder="false"
									:clearable="true"
									type="textarea"
									v-model="formData.storeMsg"
									placeholder="(从位置、服务、经营分析等方面做陈述)"
								/>
							</uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item :label-align="labelAlign" name="industry" label="您了解行业哪些品牌:" :label-width="140" :label-position="'top'">
						<uni-row>
							<uni-col :offset="2" :span="21">
								<uni-easyinput :inputBorder="false" :clearable="true" type="textarea" v-model="formData.industry" placeholder="(绝味、周黑鸭、帝皇、紫燕百味鸡...)" />
							</uni-col>
						</uni-row>
					</uni-forms-item>
					<uni-forms-item :label-align="labelAlign" name="market"  >
						<label style="color: #666;">简述下您对当地卤味行业市场的了解和趋势判断:</label>
						<uni-row>
							<uni-col :offset="2" :span="21">
								<uni-easyinput
									:inputBorder="false"
									:clearable="true"
									type="textarea"
									v-model="formData.market"
									placeholder="(从同行业品牌、商圈分布、消费水平、客户群体、商圈趋势等方面陈述)"
								/>
							</uni-col>
						</uni-row>
					</uni-forms-item>
					<view class="remind"> <text>*</text>风险与机遇并存，谨慎选择才能稳健前行</view>
					<button class="button" @click="tabChange([2, 3])">下一步</button>
				</view>
				<view v-show="TabCur == 3">
					<uni-forms-item required :label-align="labelAlign" name="teamSize" label="团队现状:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'teamSize');
								}
							"
							:value="formData.teamSize"
							:range="teamSize.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.teamSize || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="developSize" label="发展模式:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'developSize');
								}
							"
							:value="formData.developSize"
							:range="developSize.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.developSize || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="storesNum" label="开店数目标:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'storesNum');
								}
							"
							:value="formData.storesNum"
							:range="storesNum.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.storesNum || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item required :label-align="labelAlign" name="amount" label="计划投资金额:" :label-width="100">
						<picker
							@change="
								e => {
									changePicker(e, 'amount');
								}
							"
							:value="formData.amount"
							:range="amount.map(a => a.label)"
						>
							<view class="uni-input">{{ formData.amount || '请选择' }}</view>
						</picker>
					</uni-forms-item>
					<view class="remind"> <text>*</text>风险与机遇并存，谨慎选择才能稳健前行</view>
					<button class="button" @click="submit">提交申请</button>
				</view>
			</uni-forms>
		</uni-card>
	</view>
</template>

<script>
import { addOnlineFranchise } from 'src/plugins/http/server/jms';
import WucTab from 'src/components/wuc-tab/wuc-tab.vue';
export default {
	data() {
		return {
			tabList: [{ name: '基本信息' }, { name: '工作经历' }, { name: '品牌认知' }, { name: '开店计划' }],
			TabCur: 0,
			total: {
				sex: 0,
				age: 0,
				education: 0,
				socialResources: 0,
				publicResources: 0,
				complexResources: 0,
				experience: 0,
				way: 0,
				whetherEat: 0,
				brandCognition: 0,
				brandCognition: 0,
				teamSize: 0,
				developSize: 0,
				storesNum: 0,
				amount: 0
			},
			formData: {
				username: '',
				sex: '',
				age: '',
				phone: '',
				address: '',
				education: '',
				region: [],
				addressDetail: '',
				socialResources: '',
				publicResources: '',
				complexResources: '',
				wxPic: '',
				experience: '',
				way: '',
				whetherEat: '',
				favoriteFood: '',
				brandCognition: '',
				storeMsg: '',
				industry: '',
				market: '',
				teamSize: '',
				developSize: '',
				storesNum: '',
				amount: '',
				score: 0
			},
			sex: [
				{
					label: '男',
					value: '0',
					score: 0
				},
				{
					label: '女',
					value: '1',
					score: 0
				}
			],
			age: [
				{
					label: '55岁以上',
					value: '0',
					score: 6
				},
				{
					label: '45岁至55岁',
					value: '1',
					score: 7
				},
				{
					label: '28岁至45岁',
					value: '2',
					score: 10
				},
				{
					label: '18岁至28岁',
					value: '3',
					score: 8
				}
			],
			education: [
				{
					label: '本科及以上',
					value: '0',
					score: 10
				},
				{
					label: '大专',
					value: '1',
					score: 9
				},
				{
					label: '高中中专',
					value: '2',
					score: 8
				},
				{
					label: '初中及以下',
					value: '3',
					score: 6
				}
			],
			socialResources: [
				{
					label: '有实质可用的社会关系资源',
					value: '0',
					score: 2
				},
				{
					label: '有接触社会关系资源',
					value: '1',
					score: 1
				},
				{
					label: '无社会关系资源',
					value: '2',
					score: 0
				}
			],
			publicResources: [
				{
					label: '有实质可用的公共关系资源',
					value: '0',
					score: 5
				},
				{
					label: '有接触公共关系资源',
					value: '1',
					score: 2.5
				},
				{
					label: '无公共关系资源',
					value: '2',
					score: 0
				}
			],
			complexResources: [
				{
					label: '无',
					value: '0',
					score: 0
				},
				{
					label: '商超资源',
					value: '1',
					score: 0
				},
				{
					label: '街铺资源',
					value: '2',
					score: 0
				},
				{
					label: '综合体资源',
					value: '3',
					score: 0
				},
				{
					label: '机场资源',
					value: '4',
					score: 0
				},
				{
					label: '高铁资源',
					value: '5',
					score: 0
				},
				{
					label: '高速服务区资源',
					value: '6',
					score: 0
				}
			],
			experience: [
				{
					label: '具备连锁投资经验',
					value: '0',
					score: 10
				},
				{
					label: '具备连锁管理经验',
					value: '1',
					score: 9
				},
				{
					label: '从事过商业经营',
					value: '2',
					score: 8
				},
				{
					label: '未从事过商业经营',
					value: '3',
					score: 0
				},
				{
					label: '大学生创业',
					value: '4',
					score: 0
				},
				{
					label: '企事业职工',
					value: '5',
					score: 0
				},
				{
					label: '自由职业者',
					value: '6',
					score: 0
				}
			],
			way: [
				{
					label: '抖音',
					value: '0',
					score: 0
				},
				{
					label: '快手',
					value: '1',
					score: 0
				},
				{
					label: '官网',
					value: '2',
					score: 0
				},
				{
					label: '公众号',
					value: '3',
					score: 0
				},
				{
					label: '小程序',
					value: '4',
					score: 0
				},
				{
					label: '门店',
					value: '5',
					score: 0
				},
				{
					label: '转介绍',
					value: '6',
					score: 0
				},
				{
					label: '其他',
					value: '7',
					score: 0
				}
			],
			whetherEat: [
				{
					label: '否',
					value: '0',
					score: 0
				},
				{
					label: '是',
					value: '1',
					score: 0
				}
			],
			brandCognition: [
				{
					label: '高度认同',
					value: '0',
					score: 10
				},
				{
					label: '一般认同',
					value: '1',
					score: 8
				},
				{
					label: '勉强认同',
					value: '2',
					score: 6
				}
			],
			teamSize: [
				{
					label: '团队化',
					value: '0',
					score: 20
				},
				{
					label: '多人合伙',
					value: '1',
					score: 16
				},
				{
					label: '夫妻',
					value: '2',
					score: 14
				}
			],
			developSize: [
				{
					label: '专注发展煌上煌',
					value: '0',
					score: 3
				},
				{
					label: '副业投资',
					value: '1',
					score: 0
				},
				{
					label: '多元化投资',
					value: '2',
					score: 0
				}
			],
			storesNum: [
				{
					label: '具有投资1家店的能力',
					value: '0',
					score: 12
				},
				{
					label: '具有投资2家店的能力',
					value: '1',
					score: 14
				},
				{
					label: '具有投资3-4家店的能力',
					value: '2',
					score: 16
				},
				{
					label: '具有投资5-10家店的能力',
					value: '3',
					score: 18
				},
				{
					label: '具有投资10家店以上的能力',
					value: '4',
					score: 20
				}
			],
			amount: [
				{
					label: '投入>100万',
					value: '0',
					score: 30
				},
				{
					label: '50万<投入≤100万',
					value: '1',
					score: 27
				},
				{
					label: '20万<投入≤50万',
					value: '2',
					score: 25.5
				},
				{
					label: '投入≤20万',
					value: '3',
					score: 24
				}
			],
			rules: {
				username: {
					rules: [
						{
							required: true,
							errorMessage: '请输入姓名'
						}
					]
				},
				age: {
					rules: [
						{
							required: true,
							errorMessage: '请选择年龄'
						}
					]
				},
				sex: {
					rules: [
						{
							required: true,
							errorMessage: '请选择性别'
						}
					]
				},

				phone: {
					rules: [
						{
							required: true,
							errorMessage: '请输入手机号'
						},
						{
							pattern: '(^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$)',
							errorMessage: '手机号格式错误'
						}
					]
				},
				address: {
					rules: [
						{
							required: true,
							errorMessage: '请输入现居地址'
						}
					]
				},
				education: {
					rules: [
						{
							required: true,
							errorMessage: '请选择学历'
						}
					]
				},
				region: {
					rules: [
						{
							required: true,
							errorMessage: '请选择意向开店城市'
						},
						{
							format: 'array',
							errorMessage: '请选择意向开店城市'
						}
					]
				},
				addressDetail: {
					rules: [
						{
							required: true,
							errorMessage: '请选择意向开店城市'
						}
					]
				},
				socialResources: {
					rules: [
						{
							required: true,
							errorMessage: '请选择社会关系资源'
						}
					]
				},
				publicResources: {
					rules: [
						{
							required: true,
							errorMessage: '请选择公共关系资源'
						}
					]
				},
				complexResources: {
					rules: [
						{
							required: true,
							errorMessage: '请选择综合体资源'
						}
					]
				},

				experience: {
					rules: [
						{
							required: true,
							errorMessage: '请选择工作经验'
						}
					]
				},
				way: {
					rules: [
						{
							required: true,
							errorMessage: '请选择了解途径'
						}
					]
				},
				whetherEat: {
					rules: [
						{
							required: true,
							errorMessage: '请选择是否品尝过产品'
						}
					]
				},
				brandCognition: {
					rules: [
						{
							required: true,
							errorMessage: '请选择是品牌认知'
						}
					]
				},
				teamSize: {
					rules: [
						{
							required: true,
							errorMessage: '请选择团队规模'
						}
					]
				},
				developSize: {
					rules: [
						{
							required: true,
							errorMessage: '请选择发展模式'
						}
					]
				},
				storesNum: {
					rules: [
						{
							required: true,
							errorMessage: '请选择开店数目标'
						}
					]
				},
				amount: {
					rules: [
						{
							required: true,
							errorMessage: '请选择计划投资金额'
						}
					]
				}
			},
			labelAlign: 'left'
		};
	},
	components: {
		WucTab
	},
	methods: {
		tabChange(indexArr) {
			if (indexArr[0] == 0) {
				this.checkForms(['username', 'sex', 'age', 'phone', 'address', 'education'], indexArr[1]);
			} else if (indexArr[0] == 1) {
				this.checkForms(['region', 'addressDetail', 'socialResources', 'publicResources', 'complexResources', 'storePlace', 'wxPic', 'experience'], indexArr[1]);
			} else if (indexArr[0] == 2) {
				this.checkForms(['way', 'whetherEat', 'favoriteFood', 'brandCognition', 'storeMsg', 'industry', 'market'], indexArr[1]);
			} else if (indexArr[0] == 3) {
				this.checkForms(['teamSize', 'developSize', 'storesNum', 'amount'], indexArr[1]);
			}
		},

		checkForms(arr, index) {
			this.$nextTick(() => {
				this.$refs.form
					.validateField(arr)
					.then(res => {
						this.TabCur = index;
					})
					.catch(err => {
						this.$utils.showToast({
							title: '填写信息有误！请检查！'
						});
					});
			});
		},

		// 触发提交表单
		submit() {
			this.$refs.form
				.validate()
				.then(res => {
					this.formData.score = Object.values(this.total).reduce((pre,next,index,arr)=>pre+next)
					addOnlineFranchise({ data: this.formData })
						.then(({ data }) => {
							this.$utils.showToast({
								title: '数据提交成功！我们会尽快与您联系！您也可拨打4006666917详细咨询。'
							});
							this.$refs.form.resetFields();
							this.TabCur = 0;
							this.formData = {
								username: '',
								sex: '',
								age: '',
								phone: '',
								address: '',
								education: '',
								region: [],
								addressDetail: '',
								socialResources: '',
								publicResources: '',
								complexResources: '',
								wxPic: '',
								experience: '',
								way: '',
								whetherEat: '',
								favoriteFood: '',
								brandCognition: '',
								storeMsg: '',
								industry: '',
								market: '',
								teamSize: '',
								developSize: '',
								storesNum: '',
								amount: '',
								score: 0
							};
						})
						.catch(e => {
							this.$utils.showToast({
								title: e
							});
						});
				})
				.catch(err => {
					this.$utils.showToast({
						title: '填写信息有误！请检查！'
					});
				});
		},
		changePicker(e, name) {
			if (name !== 'region') {
				this.formData[name] = this[name][e.target.value].label;
				this.total[name] = this[name][e.target.value].score
			} else {
				this.formData.region = e.target.value;
			}
			this.$nextTick(() => {
				this.$refs.form
					.validateField([name])
					.then(res => {})
					.catch(err => {});
			});
		},

		ViewImage(e) {
			const params = this.getParams(e);
			wx.previewImage({
				urls: [this.formData.wxPic],
				current: this.formData.wxPic[params.index]
			});
		},

		/**
		 * 选择上传
		 */
		choose(e) {
			const params = this.getParams(e);
			const app = getApp();
			wx.chooseImage({
				count: 1, //默认9
				sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
				sourceType: ['album', 'camera'], //从相册选择
				success: res => {
					wx.showLoading({
						title: '上传中...',
						mask: true
					});
					const { wxPic } = this.formData;
					const remotePaths = [];
					for (let i = 0, len = res.tempFilePaths.length; i < len; i++) {
						const path = res.tempFilePaths[i];
						this.uploadFile(
							'https://main.hsh.com.cn/api/wxapplet/general/fileUpload',
							path,
							res => {
								remotePaths.push(JSON.parse(res.data).data);
								if (remotePaths.length === len) {
									this.formData.wxPic = [...wxPic, ...remotePaths][0];
									wx.hideLoading();
								}
							},
							() => {
								wx.hideLoading();
							}
						);
					}
				}
			});
		},

		// 图片上传
		uploadFile(url, filePath, resolve, reject) {
			wx.uploadFile({
				url: url,
				filePath: filePath,
				name: 'file',
				header: {
					'content-type': 'multipart/form-data'
				}, // 设置请求的 header
				formData: { filepath: 'returngoods' }, // HTTP 请求中其他额外的 form data
				success: res => {
					var img = JSON.parse(res.data).data;
					// app.globalData.imgLists = app.globalData.imgLists.concat(img);
					if (resolve) resolve(res);
				},
				fail: function(res) {
					if (reject) reject(res);
				},
				complete: function(res) {}
			});
		},
		/**
		 * 从e中获取参数
		 */
		getParams(e) {
			try {
				return e.currentTarget.dataset;
			} catch (e) {
				return {};
			}
		},
		/**
		 * 删除图片
		 */
		del(e) {
			const params = this.getParams(e);
			wx.showModal({
				content: '确定要删除吗？',
				cancelText: '取消',
				confirmText: '确定',
				success: res => {
					if (res.confirm) {
						this.formData.wxPic = '';
					}
				}
			});
		}
	},
	mounted() {}
};
</script>

<style lang="less" scoped>
@import 'index';
</style>
